summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUbuntu <ubuntu@ip-172-31-33-141.eu-west-3.compute.internal>2023-06-08 00:49:49 +0200
committerUbuntu <ubuntu@ip-172-31-33-141.eu-west-3.compute.internal>2023-06-08 00:52:14 +0200
commitc17ed59e85f9579e45f1c59d3c95268a1f7d361b (patch)
treed036277a96cfcf419d4598d5a8c9fff9bf2f9012
parentglobal (diff)
downloadeVinjeta-features.tar
eVinjeta-features.tar.gz
eVinjeta-features.tar.bz2
eVinjeta-features.tar.lz
eVinjeta-features.tar.xz
eVinjeta-features.tar.zst
eVinjeta-features.zip
-rw-r--r--helpers.py2
-rw-r--r--server.py29
2 files changed, 7 insertions, 24 deletions
diff --git a/helpers.py b/helpers.py
index 843d257..02f4493 100644
--- a/helpers.py
+++ b/helpers.py
@@ -57,7 +57,7 @@ def veljavnost(registrska: str, drzava: str):
}
print("\n", payload, "\n------------------\n\n\n")
r = requests.post(purl, json=payload, headers=get_headers(), verify=False)
- # print("\n"+r.text+"\n------------------\n\n\n")
+ print("\n"+r.text+"\n------------------\n\n\n")
print(r.status_code, r.reason, r.url)
return r.json()
diff --git a/server.py b/server.py
index 893acb3..e7b5bc3 100644
--- a/server.py
+++ b/server.py
@@ -73,47 +73,30 @@ def static_from_root():
return send_from_directory(app.static_folder, request.path[1:])
+@app.route("/global", methods=["POST"])
@app.route("/", methods=["POST"])
def apcall():
if "headers" in request.form:
setHeaders(request)
return "OK"
registrska = request.form["registrska"]
- try:
- ar = aux(registrska)
- app.logger.info(
- f'Registrska "{registrska}" je veljavna do {ar} ob {niceTime()}'
- )
- # discordLog(f"Registrska \"{registrska}\" je veljavna do {ar} ob {niceTime()}")
- return render_template("index.html", valid_until=ar, license_plate=registrska)
- except Exception as e:
- spamDiscord(str(e))
- app.logger.error(f"\nNapaka pri {registrska} ob {niceTime()}")
- # discordLog(f"!!!!!!!!!!!!!!!!!!!!!!!!!!!\nNapaka pri {registrska} ob {niceTime()}")
- return render_template("failure.html")
-
-
-@app.route("/global", methods=["POST"])
-def apcall_global():
- print(request.form)
- registrska = request.form["registrska"]
- drzava = request.form["drzava"]
+ drzava = request.form.get("drzava", "SI")
try:
ar = aux(registrska, drzava)
app.logger.info(
f'Registrska "{registrska}" je veljavna do {ar} ob {niceTime()}'
)
# discordLog(f"Registrska \"{registrska}\" je veljavna do {ar} ob {niceTime()}")
- return render_template(
- "index_global.html", valid_until=ar, license_plate=registrska
- )
+ user_language = request.accept_languages.best_match(["sl", "en"])
+ if user_language == "en":
+ return render_template("index_global.html", valid_until=ar, license_plate=registrska)
+ return render_template("index.html", valid_until=ar, license_plate=registrska)
except Exception as e:
spamDiscord(str(e))
app.logger.error(f"\nNapaka pri {registrska} ob {niceTime()}")
# discordLog(f"!!!!!!!!!!!!!!!!!!!!!!!!!!!\nNapaka pri {registrska} ob {niceTime()}")
return render_template("failure.html")
-
@app.route("/", methods=["GET"])
def index():
user_language = request.accept_languages.best_match(["sl", "en"])